package com.xc.pojo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

@Data
public class Result<T> {
    private boolean ok = false;
    @Schema(
            title = "状态码"
    )
    int status;
    @Schema(
            title = "提示信息"
    )
    String msg;
    @Schema(
            title = "数据"
    )
    T data;

    public Result() {
        this.setStatus(0);
    }

    public Result(T t) {
        this.setData(t);
        this.setStatus(0);
        this.setMsg("成功！");
    }

    public int getStatus() {
        return this.status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMsg() {
        return this.msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return this.data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public boolean isOk() {
        if (this.getStatus() == 0) {
            this.ok = true;
            return true;
        } else {
            return false;
        }
    }
}
